package nsip.scheduling;

import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Random;
import java.util.Set;
import nsip.model.Item;

/**
 *
 * @author Markus Goetz
 */
public class CrossoverSchedule extends AbstractSchedule {

    // private Set<Item> pendingRfqs;

    /**
     *
     * @param overplanRatio amount of relative overbooking (e.g. 1.50) of available cycles 
     * @param currentDay
     * @param random
     */
    public CrossoverSchedule(double overplanRatio, int currentDay, Random random) {
        super(overplanRatio, currentDay, random);
    }

    public void placeOrders(int date, List<Item> orders) {
        Day day = getDay(date);

        if (!day.getRfqs().isEmpty()) {
            System.out.println("[FAIL] RFQs of day not empty: " + day);
        }

        for (Item order: orders) {
            if (day.getAvailableCycles() < order.getProductionCyclesNeeded()) {
                throw new IllegalStateException(order + " can not be placed, " + day + " is full");
            }

            day.place(order);
        }
    }
}
